package com.exchange.View;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.exchange.Controller.ExchangeDataService;
import com.exchange.Controller.a;
import com.exchange.Public.ExchangeConstants;
import com.exchange.Public.f;
import com.exchange.Public.h;
import com.exchange.View.a.a;
import com.exchange.View.a.b;
import com.exchange.View.a.d;
import com.exchange.a.a;
import com.exchange.a.b.a;
import com.exchange.a.c;
import com.exchange.b.a;
import java.util.List;

public class m
  implements t.a
{
  private static final int m = 7;
  Context a;
  public View b;
  public View c;
  public ViewGroup d;
  public int e;
  public int f;
  public int g;
  public int h;
  public t i;
  private List<a> j;
  private GridView k;
  private ExchangeDataService l;

  public m(Context paramContext, ViewGroup paramViewGroup, int paramInt, ExchangeDataService paramExchangeDataService)
  {
    this.a = paramContext;
    this.d = paramViewGroup;
    this.f = paramInt;
    this.h = 7;
    this.l = paramExchangeDataService;
    a();
    u localu = new u(this);
    this.l.requestDataAsyn(this.a, localu);
  }

  public RelativeLayout a(ViewGroup paramViewGroup)
  {
    RelativeLayout localRelativeLayout = new RelativeLayout(this.a);
    localRelativeLayout.setId(100);
    localRelativeLayout.setVisibility(8);
    localRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    localRelativeLayout.setBackgroundColor(Color.argb(200, 0, 0, 0));
    paramViewGroup.addView(localRelativeLayout);
    return localRelativeLayout;
  }

  public void a()
  {
    this.e = a.t(this.a);
    switch (this.f)
    {
    default:
      this.g = 1;
    case 42:
    }
    while (true)
    {
      return;
      this.g = 0;
    }
  }

  protected void a(ViewGroup paramViewGroup, int paramInt1, int paramInt2)
  {
    int i1;
    RelativeLayout.LayoutParams localLayoutParams1;
    Button localButton;
    int i2;
    int i3;
    RelativeLayout.LayoutParams localLayoutParams2;
    RelativeLayout.LayoutParams localLayoutParams3;
    if (paramInt2 == 0)
    {
      i1 = 10;
      this.i = new t(this.a, paramInt2, false, this.l);
      this.i.setId(0);
      localLayoutParams1 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams1.addRule(i1);
      this.i.a(this);
      this.i.a(new a(b.a.b, 1F, 1F));
      localButton = new Button(this.a);
      Resources localResources = this.a.getResources();
      if (paramInt2 != 0)
        break label383;
      i2 = d.c(this.a);
      localButton.setBackgroundDrawable(localResources.getDrawable(i2));
      if (!(ExchangeConstants.TAG_HEIGHT_WRAP))
        break label395;
      i3 = -2;
      localLayoutParams2 = new RelativeLayout.LayoutParams(-1, i3);
      this.i.c = localButton;
      this.c = localButton;
      this.b = View.inflate(this.a, paramInt1, null);
      this.k = ((GridView)this.b.findViewById(b.x(this.a)));
      this.k.setAdapter(new a(this, this.a));
      this.b.setVisibility(8);
      this.i.d = this.b;
      localLayoutParams3 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams3.addRule(i1);
      if (paramInt2 != 0)
        break label410;
      this.i.addView(this.b, localLayoutParams3);
      this.i.addView(localButton, localLayoutParams2);
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            this.i.g();
            RelativeLayout localRelativeLayout1 = new RelativeLayout(this.a);
            localRelativeLayout1.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
            localRelativeLayout1.setBackgroundColor(Color.alpha(0));
            paramViewGroup.addView(localRelativeLayout1);
            if (ExchangeConstants.blur_switcher)
            {
              RelativeLayout localRelativeLayout2 = a(localRelativeLayout1);
              this.i.i = localRelativeLayout2;
            }
            localRelativeLayout1.addView(this.i, localLayoutParams1);
            return;
            i1 = 12;
          }
          label383: i2 = d.a(this.a);
        }
        label395: i3 = h.a(ExchangeConstants.TAG_HEIGHT, this.a);
      }
      label410: this.i.addView(localButton, localLayoutParams2);
      this.i.addView(this.b, localLayoutParams3);
    }
  }

  public void a(t paramt)
  {
    if (paramt.getId() == 0)
      paramt.a(new a(b.a.b, 1F, 1F));
    while (true)
    {
      paramt.c.setVisibility(0);
      return;
      paramt.a(new c(b.a.b));
    }
  }

  public void a(t paramt, View paramView)
  {
    if (paramt.getId() == 0)
      paramt.a(new c(b.a.b));
    while (true)
    {
      paramt.c.setVisibility(0);
      paramt.f();
      new a(0, this.a, this.j.subList(0, this.h), this.f, 2, 0, this.l.displayStyle).start();
      return;
      paramt.a(new a(b.a.b, 1F, 1F));
    }
  }

  public class a extends BaseAdapter
  {
    private static final int d = 8;
    List<a> a;
    private Context c;

    public a(, Context paramContext)
    {
      this.a = m.a(paramm);
      this.c = paramContext;
    }

    public int getCount()
    {
      int i;
      if (1 + this.a.size() > 8)
        i = 8;
      while (true)
      {
        return i;
        i = 1 + this.a.size();
      }
    }

    public Object getItem()
    {
      return null;
    }

    public long getItemId()
    {
      return 0L;
    }

    public View getView(, View paramView, ViewGroup paramViewGroup)
    {
      LinearLayout localLinearLayout = (LinearLayout)LinearLayout.inflate(this.c, a.w(this.c), null);
      ImageView localImageView = (ImageView)localLinearLayout.findViewById(b.b(this.c));
      TextView localTextView = (TextView)localLinearLayout.findViewById(b.c(this.c));
      S localS = new S(this, paramInt);
      if (paramInt == getCount() - 1)
      {
        localImageView.setImageResource(d.l(this.c));
        localTextView.setText("查看更多");
        localLinearLayout.setOnClickListener(new T(this));
      }
      while (true)
      {
        return localLinearLayout;
        if (paramInt < this.a.size())
        {
          localTextView.setText(((a)this.a.get(paramInt)).g);
          new f(this.c, localImageView, ((a)this.a.get(paramInt)).e, Boolean.valueOf(true)).start();
        }
        localLinearLayout.setOnClickListener(localS);
      }
    }
  }
}